﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _12泛型应用
{
    class Class1
    {
        public void Test<T>(T data)
        {
            var a = data.Equals(4);
            Console.WriteLine("this is{0},data={1},type={2}", 1, data.GetType().Name, data);
            
        }

        public void TEEE()
        {
            Test<int>(4);

        }
        public class GenericClass<T>
        {
            T[] tArray = new T[10];
            int position = 0;
            public void Push(T t) => tArray[position++] = t;
            public T Pop() => tArray[--position];
            public T[] GetTs() => tArray;

        }

        class Program
        {
            static IEnumerable<object> Main(string[] args)
            {
                var generic = new GenericClass<string>();
                generic.Push("张三");
                generic.Push("李四");
                generic.Push("王五");
                generic.Pop();

                var genericInt=new GenericClass<int>();
                genericInt.Push(1);
                genericInt.Push(2);
                genericInt.Push(3);
                genericInt.Pop();
                return null;


            }
            static  IEnumerable<string>  dddd()
            {
                return null;
            }
        }
    }
}
